
public class Punct {
	 private int x;
     private int y;
     public Punct()
     {
             this.x=0;
             this.y=0;
     }
     public Punct(int a,int b)
     {
             this.x=a;
             this.y=b;
     }
     public int getX()
     {
             return this.x;
     }
     public int getY()
     {
             return this.y;
     }
     public void setX(int x)
     {
             this.x=x;
     }
     public void setY(int y)
     {
             this.y=y;
     }
     public double distanta(Punct p2)//metoda pentru calculul distantei dintre 2 puncte, pana la punctul primit ca parametru
     {
             double r1=Math.abs(this.getX()-p2.getX());
             double r2=Math.abs(this.getY()-p2.getY());
             return r1+r2;
     }
     public String toString()
     {
             return "("+this.getX()+", "+this.getY()+")";
     }

}
